﻿//SmoothMoving.as

// 부드러운 움직임 제어 클래스 SmoothMoving 선언

class Smooth{

	//메소드 smoothMove 선언
	public static function smoothMove(_instance:MovieClip, _speed:Number, _targetX:Number, _targetY:Number):Void {

		_instance._x += _speed*(_targetX-_instance._x);
		_instance._y += _speed*(_targetY-_instance._y);

		if (Math.abs(_targetX-_instance._x)<1 && Math.abs(_targetY-_instance._y)<1) {
			_instance._x = _targetX;
			_instance._y = _targetY;
		}
	}
	//

	//메소드 smoothArea 선언
	public static function smoothArea(_instance:MovieClip, _speed:Number, _targetWidth:Number, _targetHeight:Number):Void {

		_instance._width += _speed*(_targetWidth-_instance._width);
		_instance._height += _speed*(_targetHeight-_instance._height);

		if (Math.abs(_targetWidth-_instance._width)<1 && Math.abs(_targetHeight-_instance._height)<1) {
			_instance._width = _targetWidth;
			_instance._height = _targetHeight;
		}
	}
	//
}